package com.qyer.commons.utils;/**
 * User: Z J Wu Date: 2016/05/18 Time: 22:58 Package: com.qyer.commons.utils
 */

import java.util.Random;

public class Probability {

  private static class InnerHolder {

    private static final Probability INSTANCE = new Probability();
  }

  private Probability() {
  }

  public static Probability getInstance() {
    return InnerHolder.INSTANCE;
  }

  private final Random random = new Random();

  public boolean generateBooleanProbability(int percentOfTrue) {
    return random.nextInt(100) < percentOfTrue;
  }
}
